package com.kaifamiao.N0823;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;

public class Node1 {

    public static void main(String[] args) {

        Date date = new Date();
        System.out.println("未格式化后的时间" + date);

        SimpleDateFormat sdf = new SimpleDateFormat();
        String str = sdf.format(date);
        System.out.println("格式化后的时间" + str);

        Calendar calender = new Calendar() {
            @Override
            protected void computeTime() {

            }

            @Override
            protected void computeFields() {

            }

            @Override
            public void add(int field, int amount) {

            }

            @Override
            public void roll(int field, boolean up) {

            }

            @Override
            public int getMinimum(int field) {
                return 0;
            }

            @Override
            public int getMaximum(int field) {
                return 0;
            }

            @Override
            public int getGreatestMinimum(int field) {
                return 0;
            }

            @Override
            public int getLeastMaximum(int field) {
                return 0;
            }
        };

        calender.set(2,2022);


        System.out.println(calender);

        Calendar calender1 = Calendar.getInstance();

        int year = calender.get(Calendar.YEAR);

        StringBuffer today = new StringBuffer("我的生日是");

        today.append(year).append("年");

        System.out.println(today.toString());
    }

    @Override
    public String toString() {
        return "Node1{}";
    }
}
